import {createRouter, createWebHashHistory} from "vue-router"

const routes = [
    {
        // 登录界面
        path: '/',
        name: 'login',
        component: () => import(/*webpackChunkName:'Login'*/'@/page/login.vue'), // 按需引用
    },
    {
        // 登录后首页
        path: '/index',
        name: 'index',
        component: () => import(/*webpackChunkName:'Index'*/'@/page/index/index.vue'), // 按需引用
        // redirect: '/user', // 定向路由（页面进入index后进入的页面）
        // 二级路由
        children: [
            {
                // 用户管理
                path: '/user',
                name: 'user',
                component: () => import(/*webpackChunkName:'User'*/'@/page/user.vue'), // 按需引用
            }
            ,
            {
                // 订单管理
                path: '/order',
                name: 'order',
                component: () => import(/*webpackChunkName:'Order'*/'@/page/order.vue'), // 按需引用
            }
        ]
    }

]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
})

export default router